#ifndef __SHA1_CLASS__
#define __SHA1_CLASS__

#include "MessageDigest.h"

class SHA1: public MessageDigest {
private:
	uint32_t mDigest[5];	// 20-byte digest
	uint8_t mBuffer[64];	// 64-byte chunk
	uint32_t mBufferSizeLow, mBufferSizeHigh;
	void transform(const uint8_t *block);

	static void byte_to_int(uint32_t *dest, const uint8_t *src, uint32_t ilen);
	static void int_to_byte(uint8_t *dest, const uint32_t *src, uint32_t ilen);

public:
	SHA1():MessageDigest(TYPE_SHA1, 20){}
	void init();
	void update(const void *data, unsigned int size);
	void final();
	const unsigned char *getDigest(){return (unsigned char*)mDigest;}
};

#endif
